package com.whu.controller;

import com.alibaba.fastjson.JSON;
import com.whu.aircraft.Aircraft;
import com.whu.aircraft.Location;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class LocationController {

    Aircraft aircraft = new Aircraft();

    //获取实时位置
    @RequestMapping("/getCurrentLocation")
    public String getCurrentLocation() {
        //aircraft.setLocation(new Location(114.360734f, 30.541093f, 2.0f));
        return JSON.toJSONString(new Location(114.360734f, 30.541093f, 4.0f));
    }

    //获取飞行路径
    @RequestMapping("/getFlyPath")
    public String getFlyPath() {
        List<Location> path = new ArrayList<>();
        path.add(new Location(114.360734f, 30.541093f, 4.0f));
        path.add(new Location(114.360734f, 30.545093f, 4.0f));
        return JSON.toJSONString(path);
    }

}
